home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / mac / misc / math / lifemake.cpt / LifeMaker Demo.rsrc / LIF3_16967_Dendrite < prev    next >
Encoding:
Text File  |  1991-07-16  |  919 b   |  25 lines

  1. (* Dendrite simulates diffusion limited aggregation. The rule
  2.    is from Toffoli and Margolus page 167. State 1 are particles
  3.    that move randomly until they enter a block containing
  4.    the dendritic growth (state 2). The particle is then added
  5.    to the growth.
  6.  
  7.    To see how this works select all the cells and randomize
  8.    the low bit. Try starting with a density of 10%. Then
  9.    place a seed with state 2 in the center. The particles
  10.    will move about and gradually accumulate onto the seed. *)
  11. RULE Dendrite (cell, opp, cw, ccw)
  12.    VAR new, growth
  13. BEGIN
  14.    growth := cell[1] OR opp[1] OR cw[1] OR ccw[1]
  15.    IF growth THEN                     (* does block contain growth? *)
  16.       new := 2*(cell[1] OR cell[0])   (* yes, particle sticks *)
  17.    ELSE
  18.       IF rand THEN                    (* no, particles do random walk *)
  19.          new := cw[0]
  20.       ELSE
  21.          new := ccw[0]
  22.       END
  23.    END
  24.    RETURN new
  25. END